package com.situ.mall.admin.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.situ.mall.admin.entity.User;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import javax.swing.*;
import java.util.List;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author 闫佳宁
 * @since 2023-09-11
 */
public interface UserMapper extends BaseMapper<User> {

    @Select("select * from user where id = #{id}")
    List<User> selectById(Integer id);

    @Select("select * from user where username = #{username}")
    User selectByUsername(String username);

    List<User> select(@Param("username") String username, @Param("name") String name, @Param("status") Integer status);

    void del(String[] split);

    @Update("update user set status =-1 where id = #{id}")
    void delete(Integer id);


    @Update("update user set username = #{username},name = #{name},tel = #{tel},avatar=#{avatar} where id = #{id}")
    void update(User user);


    @Update("update user set password=#{newPassword} where id=#{id}")
    void UpdatePassword(@Param("newPassword") String newPassword, @Param("id") Integer id);
}
